* Boosting the understanding and approval of anti-Corona measures
* Reducing Exponential Growth Bias and its Effects Through Educational Nudges
* in: Swiss Political Science Review
* Sebastian Jäckle, Felix Ettensperger
* Felix Ettensperger

* set path
cd "YOUR PATH\replication\"


clear all


* install packages
ssc install estout, replace
ssc install stripplot, replace
ssc install coefplot, replace


* Lammers et al. Replication Data Study 3 (https://osf.io/xjwbg/) --> SPSS data converted to .dta
use "material\Lammers_Study3.dta", clear

* Merge survey data
merge 1:1 _n using "material\Corona_student_survey_Nov_2020.dta"


* rename variables
rename controlDV  lammers_est15_c_group_metric 
rename saturday28 lammers_est03_e_group_metric
rename tuesday31  lammers_est06_e_group_metric
rename friday3    lammers_est09_e_group_metric
rename monday6    lammers_est12_e_group_metric
rename thursday9  lammers_est15_e_group_metric
rename treatment  lammers_treatment

rename v_93 bundesland
rename lfdn id
rename v_144 strain
rename Geschlecht gender
rename v_42 left_right
rename v_344 trust
rename v_389 restrict_rights
rename v_293 contacts_reduced
rename v_296 mask_wearing
rename v_292 app_using
rename v_222 tested_positive
rename v_287 quarantine
rename v_494 est15_c_group
rename v_364 est03_e_group
rename v_365 est06_e_group
rename v_374 est09_e_group
rename v_379 est12_e_group
rename v_384 est15_e_group
rename v_358 contact_reductions
rename v_359 restaurant_closing
rename v_360 mask_mandatory
rename v_361 hybrid_school
rename v_553 measures_appropriate

replace lammers_est15_c_group_metric = 1000 * lammers_est15_c_group_metric
replace lammers_est15_e_group_metric = 1000 * lammers_est15_e_group_metric
replace lammers_est12_e_group_metric = 1000 * lammers_est12_e_group_metric
replace lammers_est09_e_group_metric = 1000 * lammers_est09_e_group_metric
replace lammers_est06_e_group_metric = 1000 * lammers_est06_e_group_metric
replace lammers_est03_e_group_metric = 1000 * lammers_est03_e_group_metric

keep 	lammers* id strain gender left_right trust restrict_rights contacts_reduced mask_wearing app_using ///
		bundesland tested_positive quarantine est* contact_reductions restaurant_closing mask_mandatory hybrid_school measures_appropriate
		

* missing values 
mvdecode * , mv(-77)		
mvdecode * , mv(0)			

* estimations metric
* Control Group after 15 days
gen est15_c_group_metric = .
replace est15_c_group_metric = 50000 		if est15_c_group == 1
replace est15_c_group_metric = 100000 		if est15_c_group == 2
replace est15_c_group_metric = 150000 		if est15_c_group == 3
replace est15_c_group_metric = 200000 		if est15_c_group == 4
replace est15_c_group_metric = 250000 		if est15_c_group == 5
replace est15_c_group_metric = 300000 		if est15_c_group == 6
replace est15_c_group_metric = 350000 		if est15_c_group == 7
replace est15_c_group_metric = 400000 		if est15_c_group == 8
replace est15_c_group_metric = 450000 		if est15_c_group == 9
replace est15_c_group_metric = 500000 		if est15_c_group == 10
replace est15_c_group_metric = 550000 		if est15_c_group == 11
replace est15_c_group_metric = 600000 		if est15_c_group == 12
replace est15_c_group_metric = 650000 		if est15_c_group == 13
replace est15_c_group_metric = 700000 		if est15_c_group == 14
replace est15_c_group_metric = 750000 		if est15_c_group == 15
replace est15_c_group_metric = 800000 		if est15_c_group == 16
replace est15_c_group_metric = 850000 		if est15_c_group == 17
replace est15_c_group_metric = 900000 		if est15_c_group == 18
replace est15_c_group_metric = 950000 		if est15_c_group == 19
replace est15_c_group_metric = 1000000 		if est15_c_group == 20
replace est15_c_group_metric = 1100000 		if est15_c_group == 21
replace est15_c_group_metric = 1200000 		if est15_c_group == 22
replace est15_c_group_metric = 1300000 		if est15_c_group == 23
replace est15_c_group_metric = 1400000 		if est15_c_group == 24
replace est15_c_group_metric = 1500000 		if est15_c_group == 25
replace est15_c_group_metric = 1600000 		if est15_c_group == 26

* Treatment Group after 15 days
gen est15_e_group_metric = .
replace est15_e_group_metric = 50000 		if est15_e_group == 1
replace est15_e_group_metric = 100000 		if est15_e_group == 2
replace est15_e_group_metric = 150000 		if est15_e_group == 3
replace est15_e_group_metric = 200000 		if est15_e_group == 4
replace est15_e_group_metric = 250000 		if est15_e_group == 5
replace est15_e_group_metric = 300000 		if est15_e_group == 6
replace est15_e_group_metric = 350000 		if est15_e_group == 7
replace est15_e_group_metric = 400000 		if est15_e_group == 8
replace est15_e_group_metric = 450000 		if est15_e_group == 9
replace est15_e_group_metric = 500000 		if est15_e_group == 10
replace est15_e_group_metric = 550000 		if est15_e_group == 11
replace est15_e_group_metric = 600000 		if est15_e_group == 12
replace est15_e_group_metric = 650000 		if est15_e_group == 13
replace est15_e_group_metric = 700000 		if est15_e_group == 14
replace est15_e_group_metric = 750000 		if est15_e_group == 15
replace est15_e_group_metric = 800000 		if est15_e_group == 16
replace est15_e_group_metric = 850000 		if est15_e_group == 17
replace est15_e_group_metric = 900000 		if est15_e_group == 18
replace est15_e_group_metric = 950000 		if est15_e_group == 19
replace est15_e_group_metric = 1000000 		if est15_e_group == 20
replace est15_e_group_metric = 1100000 		if est15_e_group == 21
replace est15_e_group_metric = 1200000 		if est15_e_group == 22
replace est15_e_group_metric = 1300000 		if est15_e_group == 23
replace est15_e_group_metric = 1400000 		if est15_e_group == 24
replace est15_e_group_metric = 1500000 		if est15_e_group == 25
replace est15_e_group_metric = 1600000 		if est15_e_group == 26

* Treatment Group after 12 days
gen est12_e_group_metric = .
replace est12_e_group_metric = 50000 		if est12_e_group == 1
replace est12_e_group_metric = 100000 		if est12_e_group == 2
replace est12_e_group_metric = 150000 		if est12_e_group == 3
replace est12_e_group_metric = 200000 		if est12_e_group == 4
replace est12_e_group_metric = 250000 		if est12_e_group == 5
replace est12_e_group_metric = 300000 		if est12_e_group == 6
replace est12_e_group_metric = 350000 		if est12_e_group == 7
replace est12_e_group_metric = 400000 		if est12_e_group == 8
replace est12_e_group_metric = 450000 		if est12_e_group == 9
replace est12_e_group_metric = 500000 		if est12_e_group == 10
replace est12_e_group_metric = 550000 		if est12_e_group == 11
replace est12_e_group_metric = 600000 		if est12_e_group == 12
replace est12_e_group_metric = 650000 		if est12_e_group == 13
replace est12_e_group_metric = 700000 		if est12_e_group == 14
replace est12_e_group_metric = 750000 		if est12_e_group == 15
replace est12_e_group_metric = 800000 		if est12_e_group == 16
replace est12_e_group_metric = 850000 		if est12_e_group == 17
replace est12_e_group_metric = 900000 		if est12_e_group == 18
replace est12_e_group_metric = 950000 		if est12_e_group == 19
replace est12_e_group_metric = 1000000 		if est12_e_group == 20
replace est12_e_group_metric = 1100000 		if est12_e_group == 21
replace est12_e_group_metric = 1200000 		if est12_e_group == 22
replace est12_e_group_metric = 1300000 		if est12_e_group == 23
replace est12_e_group_metric = 1400000 		if est12_e_group == 24
replace est12_e_group_metric = 1500000 		if est12_e_group == 25
replace est12_e_group_metric = 1600000 		if est12_e_group == 26

* Treatment Group after 09 days
gen est09_e_group_metric = .
replace est09_e_group_metric = 50000 		if est09_e_group == 1
replace est09_e_group_metric = 100000 		if est09_e_group == 2
replace est09_e_group_metric = 150000 		if est09_e_group == 3
replace est09_e_group_metric = 200000 		if est09_e_group == 4
replace est09_e_group_metric = 250000 		if est09_e_group == 5
replace est09_e_group_metric = 300000 		if est09_e_group == 6
replace est09_e_group_metric = 350000 		if est09_e_group == 7
replace est09_e_group_metric = 400000 		if est09_e_group == 8
replace est09_e_group_metric = 450000 		if est09_e_group == 9
replace est09_e_group_metric = 500000 		if est09_e_group == 10
replace est09_e_group_metric = 550000 		if est09_e_group == 11
replace est09_e_group_metric = 600000 		if est09_e_group == 12
replace est09_e_group_metric = 650000 		if est09_e_group == 13
replace est09_e_group_metric = 700000 		if est09_e_group == 14
replace est09_e_group_metric = 750000 		if est09_e_group == 15
replace est09_e_group_metric = 800000 		if est09_e_group == 16
replace est09_e_group_metric = 850000 		if est09_e_group == 17
replace est09_e_group_metric = 900000 		if est09_e_group == 18
replace est09_e_group_metric = 950000 		if est09_e_group == 19
replace est09_e_group_metric = 1000000 		if est09_e_group == 20
replace est09_e_group_metric = 1100000 		if est09_e_group == 21
replace est09_e_group_metric = 1200000 		if est09_e_group == 22
replace est09_e_group_metric = 1300000 		if est09_e_group == 23
replace est09_e_group_metric = 1400000 		if est09_e_group == 24
replace est09_e_group_metric = 1500000 		if est09_e_group == 25
replace est09_e_group_metric = 1600000 		if est09_e_group == 26

* Treatment Group after 06 days
gen est06_e_group_metric = .
replace est06_e_group_metric = 50000 		if est06_e_group == 1
replace est06_e_group_metric = 100000 		if est06_e_group == 2
replace est06_e_group_metric = 150000 		if est06_e_group == 3
replace est06_e_group_metric = 200000 		if est06_e_group == 4
replace est06_e_group_metric = 250000 		if est06_e_group == 5
replace est06_e_group_metric = 300000 		if est06_e_group == 6
replace est06_e_group_metric = 350000 		if est06_e_group == 7
replace est06_e_group_metric = 400000 		if est06_e_group == 8
replace est06_e_group_metric = 450000 		if est06_e_group == 9
replace est06_e_group_metric = 500000 		if est06_e_group == 10
replace est06_e_group_metric = 550000 		if est06_e_group == 11
replace est06_e_group_metric = 600000 		if est06_e_group == 12
replace est06_e_group_metric = 650000 		if est06_e_group == 13
replace est06_e_group_metric = 700000 		if est06_e_group == 14
replace est06_e_group_metric = 750000 		if est06_e_group == 15
replace est06_e_group_metric = 800000 		if est06_e_group == 16
replace est06_e_group_metric = 850000 		if est06_e_group == 17
replace est06_e_group_metric = 900000 		if est06_e_group == 18
replace est06_e_group_metric = 950000 		if est06_e_group == 19
replace est06_e_group_metric = 1000000 		if est06_e_group == 20
replace est06_e_group_metric = 1100000 		if est06_e_group == 21
replace est06_e_group_metric = 1200000 		if est06_e_group == 22
replace est06_e_group_metric = 1300000 		if est06_e_group == 23
replace est06_e_group_metric = 1400000 		if est06_e_group == 24
replace est06_e_group_metric = 1500000 		if est06_e_group == 25
replace est06_e_group_metric = 1600000 		if est06_e_group == 26

* Treatment Group after 03 days
gen est03_e_group_metric = .
replace est03_e_group_metric = 50000 		if est03_e_group == 1
replace est03_e_group_metric = 100000 		if est03_e_group == 2
replace est03_e_group_metric = 150000 		if est03_e_group == 3
replace est03_e_group_metric = 200000 		if est03_e_group == 4
replace est03_e_group_metric = 250000 		if est03_e_group == 5
replace est03_e_group_metric = 300000 		if est03_e_group == 6
replace est03_e_group_metric = 350000 		if est03_e_group == 7
replace est03_e_group_metric = 400000 		if est03_e_group == 8
replace est03_e_group_metric = 450000 		if est03_e_group == 9
replace est03_e_group_metric = 500000 		if est03_e_group == 10
replace est03_e_group_metric = 550000 		if est03_e_group == 11
replace est03_e_group_metric = 600000 		if est03_e_group == 12
replace est03_e_group_metric = 650000 		if est03_e_group == 13
replace est03_e_group_metric = 700000 		if est03_e_group == 14
replace est03_e_group_metric = 750000 		if est03_e_group == 15
replace est03_e_group_metric = 800000 		if est03_e_group == 16
replace est03_e_group_metric = 850000 		if est03_e_group == 17
replace est03_e_group_metric = 900000 		if est03_e_group == 18
replace est03_e_group_metric = 950000 		if est03_e_group == 19
replace est03_e_group_metric = 1000000 		if est03_e_group == 20
replace est03_e_group_metric = 1100000 		if est03_e_group == 21
replace est03_e_group_metric = 1200000 		if est03_e_group == 22
replace est03_e_group_metric = 1300000 		if est03_e_group == 23
replace est03_e_group_metric = 1400000 		if est03_e_group == 24
replace est03_e_group_metric = 1500000 		if est03_e_group == 25
replace est03_e_group_metric = 1600000 		if est03_e_group == 26

gen exp_group = .
replace exp_group = 1 if  est15_c_group == . 	
replace exp_group = 0 if  est15_e_group == . 
replace exp_group = . if id == .

label define group 0 "Control group" 1 "Treatment group" 
label values exp_group group

gen gender_2 = .
replace gender_2 = 0 if gender == 1
replace gender_2 = 1 if gender == 2

label define gender_2 0 "male" 1 "female"
label values gender_2 gender_2

replace tested_positive  = 0 if tested_positive == 2

replace quarantine  = 0 if quarantine == 2

label variable exp_group "treatment group"
label variable strain "burden of Covid-19 pandemic (1-5)"
label variable gender_2 "male = 0 / female  = 1" 
label variable left_right "left = 1 / right = 11"
label variable trust "general social trust (1-7)"
label variable restrict_rights "restrict individual rights in order to guarantee safety (1-5)"
label variable measures_appropriate "anti-Corona-measures appropriate (1-5)"  
label variable quarantine "have been in quarantine"
label variable tested "have been tested positive on Covid-19"


* Table for fig 1
gen str 	date_str = "03/28/2020" in 1
replace  	date_str = "03/31/2020" in 2
replace  	date_str = "04/03/2020" in 3
replace  	date_str = "04/06/2020" in 4
replace  	date_str = "04/09/2020" in 5


gen date = date(date_str, "MDY")
replace date = 22014.08 in 6
replace date = 22013.92 in 7
format date %dM_d 

gen lammers_exp_mean = .
gen lammers_control_mean = .
gen freiburg_exp_mean = .
gen freiburg_control_mean = .
gen lammers_exp_sd = .
gen lammers_control_sd = .
gen freiburg_exp_sd = .
gen freiburg_control_sd = .

sum lammers_est15_c_group_metric
replace lammers_control_mean = 	r(mean) in 6
replace lammers_control_sd = 	r(sd) 	in 6

sum lammers_est03_e_group_metric
replace lammers_exp_mean = 	r(mean) in 1
replace lammers_exp_sd = 	r(sd) 	in 1

sum lammers_est06_e_group_metric
replace lammers_exp_mean = 	r(mean) in 2
replace lammers_exp_sd = 	r(sd) 	in 2

sum lammers_est09_e_group_metric
replace lammers_exp_mean = 	r(mean) in 3
replace lammers_exp_sd = 	r(sd) 	in 3

sum lammers_est12_e_group_metric
replace lammers_exp_mean = 	r(mean) in 4
replace lammers_exp_sd = 	r(sd) 	in 4

sum lammers_est15_e_group_metric
replace lammers_exp_mean = 	r(mean) in 5
replace lammers_exp_sd = 	r(sd) 	in 5


sum est15_c_group_metric
replace freiburg_control_mean 	= 	r(mean) in 7
replace freiburg_control_sd 	= 	r(sd) 	in 7

sum est03_e_group_metric
replace freiburg_exp_mean 	= 	r(mean) in 1
replace freiburg_exp_sd 	= 	r(sd) 	in 1

sum est06_e_group_metric
replace freiburg_exp_mean 	= 	r(mean) in 2
replace freiburg_exp_sd 	= 	r(sd) 	in 2

sum est09_e_group_metric
replace freiburg_exp_mean 	= 	r(mean) in 3
replace freiburg_exp_sd 	= 	r(sd) 	in 3

sum est12_e_group_metric
replace freiburg_exp_mean 	= 	r(mean) in 4
replace freiburg_exp_sd 	= 	r(sd) 	in 4

sum est15_e_group_metric
replace freiburg_exp_mean 	= 	r(mean) in 5
replace freiburg_exp_sd 	= 	r(sd) 	in 5

gen lammers_control_minus_sd = lammers_control_mean - lammers_control_sd
gen lammers_control_plus_sd = lammers_control_mean + lammers_control_sd
gen freiburg_control_minus_sd = freiburg_control_mean - freiburg_control_sd
gen freiburg_control_plus_sd = freiburg_control_mean + freiburg_control_sd
gen lammers_exp_minus_sd = lammers_exp_mean - lammers_exp_sd
gen lammers_exp_plus_sd = lammers_exp_mean + lammers_exp_sd
gen freiburg_exp_minus_sd = freiburg_exp_mean - freiburg_exp_sd
gen freiburg_exp_plus_sd = freiburg_exp_mean + freiburg_exp_sd

set scheme plottig 
		
* Freiburg vs. Lammers et al. 2020 (including +- 1 SD)		
twoway 	(rarea lammers_exp_minus_sd lammers_exp_plus_sd date, fcolor(black%20) lcolor(black%20) lwidth(none)) 											///
		(connected lammers_exp_mean date, lcolor(black) lpattern(dash) mcolor(black) msymbol(Oh)) 																						///
		(rarea freiburg_exp_minus_sd freiburg_exp_plus_sd date, fcolor(red%20) lcolor(blue%20) lwidth(none)) 											///
		(connected freiburg_exp_mean date, lcolor(red) mcolor(red) msymbol(Sh)) 																										///
		(scatter lammers_control_mean date, mcolor(black) msymbol(circle))																				///
		(rcap lammers_control_minus_sd lammers_control_plus_sd date, lcolor(black%20)) 																	///
		(scatter freiburg_control_mean date, mcolor(red) msymbol(square)) 																				///
		(rcap freiburg_control_minus_sd freiburg_control_plus_sd date, lcolor(red%20)),																	///
xlabel(22002(3)22014) 																																	///
ytitle("Estimation of SARS-CoV-2 infections")																											///
xtitle("")																																				///
legend(cols(2) on order(4 "Treatment group" 7 "Control group" 2 "Treatment group (Lammers et al., 2020)." 5 "Control group (Lammers et al., 2020)") ///
position(6)) plegend(position(6))
graph export "analysis\fig_2a.pdf", replace
graph export "analysis\fig_2.emf", replace

* Freiburg vs. Lammers et al. 2020 (only means)		
twoway 	(line lammers_exp_mean date, lcolor(black) lpattern(dash)) 																						///
		(line freiburg_exp_mean date, lcolor(red)) 																										///
		(scatter lammers_control_mean date, mcolor(black) msymbol(circle))																				///
		(scatter freiburg_control_mean date, mcolor(red) msymbol(square)), 																				///
xlabel(22002(3)22014) 																																	///
ytitle("Estimation of SARS-CoV-2 infections")																											///
xtitle("")																																				///
legend(cols(2) on order(2 "Treatment Group" 4 "Control Group" 1 "Treatment Group (Lammers et al., 2020)." 3 "Control Group (Lammers et al., 2020)") ///
position(6)) plegend(position(6))
graph export "analysis\fig_2b.pdf", replace


* Estimation of Infections in 15 days (control group and experimental group)
gen 	est15_both_groups_metric = est15_c_group_metric
replace est15_both_groups_metric = est15_e_group_metric if est15_e_group_metric != . 

* ID_complete: 
gen completed = 1 if est15_both_groups_metric != .

* testing equality of variances
sdtest est15_both_groups_metric if completed == 1 , by(exp_group)
* --> variances are equal
robvar est15_both_groups_metric if completed == 1 , by(exp_group)
* --> variances are not equal according to Levene's Test (W0) und Levene's Test using the 10% trimmed mean (W10). Accordig Levene's Test using the median(W50) the variances are equal.

 * t-test comparing means of estimations after 15 days (control vs. experimental group)
ttest est15_both_groups_metric if completed == 1 , by(exp_group) unequal
ttest est15_both_groups_metric if completed == 1 , by(exp_group) 
ttest est15_both_groups_metric if completed == 1 , by(exp_group) welch unequal

* Table: experimental/control group vs. social distancing measures
tab contact_reductions 	exp_group if completed ==1
tab restaurant_closing 	exp_group if completed ==1
tab mask_mandatory 		exp_group if completed ==1
tab hybrid_school 		exp_group if completed ==1


* Mann-Whitney-U-Test
ranksum contact_reductions  if completed ==1,  by(exp_group)
ranksum restaurant_closing  if completed ==1,  by(exp_group)
ranksum mask_mandatory  	if completed ==1,  by(exp_group)
ranksum hybrid_school  		if completed ==1,  by(exp_group)

* t-test (Assumption: 10-point scale is interval-scale)
sdtest contact_reductions  if completed ==1,  by(exp_group) 
	* --> equal variances
ttest contact_reductions  if completed ==1,  by(exp_group) welch

sdtest restaurant_closing  if completed ==1,  by(exp_group)
	* --> equal variances
ttest restaurant_closing  if completed ==1,  by(exp_group) welch
	
sdtest mask_mandatory  if completed ==1,  by(exp_group)
	* --> equal variances
ttest mask_mandatory  if completed ==1,  by(exp_group) welch

sdtest hybrid_school  if completed ==1,  by(exp_group)
	* --> equal variances
ttest hybrid_school  if completed ==1,  by(exp_group) welch	

*** Figure 2: Stripplots of DV by experimental/control group 
stripplot contact_reductions, 	vertical stack center  over(exp_group) title("Contact restrictions") ytitle("") ms(O) xtitle("") refline(lcolor(red)) 
graph save "analysis\fig3_a.gph", replace
stripplot restaurant_closing,	vertical stack center  over(exp_group) title("Closing restaurants") ytitle("") ms(O) xtitle("") refline(lcolor(red)) 
graph save "analysis\fig3_b.gph", replace
stripplot mask_mandatory, 		vertical stack center  over(exp_group) title("Wearing masks mandatory") ytitle("") ms(O) xtitle("") refline(lcolor(red)) 
graph save "analysis\fig3_c.gph", replace
stripplot hybrid_school, 		vertical stack center  over(exp_group) title("Hybrid teaching at schools") ytitle("") ms(O) xtitle("") refline(lcolor(red)) 
graph save "analysis\fig3_d.gph", replace

*graph combine "analysis\fig3_a.gph" "analysis\fig3_b.gph" "analysis\fig3_c.gph" "analysis\fig3_d.gph", title("Approval ratings in experimental and control group (+ group means)" ) note("1 = strongly oppose, 10 = strongly support", tstyle(size(vsmall))) 
graph combine "analysis\fig3_a.gph" "analysis\fig3_b.gph" "analysis\fig3_c.gph" "analysis\fig3_d.gph",  note("1 = strongly oppose, 10 = strongly support", tstyle(size(vsmall))) 
graph export "analysis\fig_3.pdf", replace
graph export "analysis\fig_3.emf", replace

*** OLS-Regression
gen no_missing_reg = 1 if completed ==1 & trust !=. & gender_2 !=.

* Table of summary statistics
estpost sum contact_reductions restaurant_closing mask_mandatory hybrid_school exp_group gender_2 left_right trust  measures_appropriate restrict_rights strain tested_positive quarantine if no_missing_reg ==1
esttab using "analysis\table_A1.rtf", cells("count mean sd min max")  replace

* M1
reg contact_reductions exp_group gender_2 left_right trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1
reg contact_reductions exp_group gender_2 left_right trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1, beta
hettest
estat imtest, white
reg contact_reductions exp_group gender_2 left_right trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1, robust
vif

coefplot, drop(_cons) xline(0) msymbol(d) mcolor(white) levels(95 90 ) ciopts(lwidth(3 ..) lcolor(*.33 *.66 )) ///
legend(order( 1 "95%" 2 "90%" ) rows(1) position(6))
graph export "analysis\fig_4.pdf", replace
graph export "analysis\fig_4.emf", replace

* Regression tables for Appendix A2
reg contact_reductions exp_group if no_missing_reg == 1
estimates store m0, title(M0)

reg contact_reductions exp_group gender_2 left_right trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1
estimates store m1, title(M1)

reg contact_reductions exp_group gender_2 left_right trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1, robust
estimates store m1_r, title(M1 robust)

reg contact_reductions exp_group gender_2 left_right trust  quarantine tested  if no_missing_reg == 1
estimates store m2, title(M2)

* regression taking the ordinal independent variables as categorical
* see https://www3.nd.edu/~rwilliam/stats3/OrdinalIndependent.pdf

reg contact_reductions exp_group gender_2 left_right i.trust  i.measures_appropriate i.restrict_rights i.strain  if no_missing_reg == 1
estimates store m1_cat, title(M1 categorical independent variables)

*** Ordered Logistic Regression
ologit contact_reductions exp_group gender_2 left_right trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1, or
est store m1_ord, title(M! ordinal logit)

* table A2
esttab m1 m1_r m1_cat m1_ord m2 using "analysis\table_A2.rtf",  ar2 pr2 (2)replace star(* 0.10 ** 0.05 *** 0.01)  legend label


* Mann-Whitney-U-Test
ranksum left_right  				if completed ==1,  by(exp_group)
ranksum trust  						if completed ==1,  by(exp_group)
ranksum measures_appropriate  		if completed ==1,  by(exp_group)
ranksum restrict_rights  			if completed ==1,  by(exp_group)
ranksum strain  					if completed ==1,  by(exp_group)

sdtest left_right  if completed ==1,  by(exp_group) 
	* --> equal variances
ttest left_right  if completed ==1,  by(exp_group) welch

sdtest trust  if completed ==1,  by(exp_group) 
	* --> equal variances
ttest trust  if completed ==1,  by(exp_group) welch

sdtest measures_appropriate  if completed ==1,  by(exp_group) 
	* --> equal variances
ttest measures_appropriate  if completed ==1,  by(exp_group) welch

sdtest restrict_rights  if completed ==1,  by(exp_group) 
	* --> equal variances
ttest restrict_rights  if completed ==1,  by(exp_group) welch

sdtest strain  if completed ==1,  by(exp_group) 
	* --> equal variances
ttest strain  if completed ==1,  by(exp_group) welch

* Test for proportional odds assumption --> omodel-ado
* search omodel

omodel logit contact_reductions exp_group gender_2 left_right trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1
* --> LR-Test signifikant, d.h. die Proportional Odds Assumption does not hold --> generalized ordinal logit

* Interaction-Effects

* Fig A1
	** gender x treatment
	reg contact_reductions i.exp_group##i.gender_2 left_right trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1, robust
	margins  exp_group, at(gender_2=(0 1)) 
	marginsplot,  xtitle("") title("") ytitle("Prediction for approval of contact restrictions (+ 95% CI)")
	graph export "analysis\fig_A1.pdf", replace
	graph export "analysis\fig_A1.emf", replace
	
* Fig A2	
	** left_right x treatment
	reg contact_reductions i.exp_group##c.left_right gender_2  trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1, robust
	margins , dydx(exp_group) at(left_right=(1(1)11))
	marginsplot, title ("") ytitle("Effects on approval of contact restrictions")
	graph export "analysis\fig_A2.pdf", replace
	graph export "analysis\fig_A2.emf", replace

	
* Fig A3
reg restaurant_closing exp_group gender_2 left_right trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1
coefplot, drop(_cons) xline(0) msymbol(d) mcolor(white) levels(95 90 ) ciopts(lwidth(3 ..) lcolor(*.33 *.66 )) ///
legend(order( 1 "95%" 2 "90%" ) rows(1) position(6))
graph export "analysis\fig_A3.pdf", replace
graph export "analysis\fig_A3.emf", replace

* Fig A4
reg mask_mandatory exp_group gender_2 left_right trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1
coefplot, drop(_cons) xline(0) msymbol(d) mcolor(white) levels(95 90 ) ciopts(lwidth(3 ..) lcolor(*.33 *.66 )) ///
legend(order( 1 "95%" 2 "90%" ) rows(1) position(6))
graph export "analysis\fig_A4.pdf", replace
graph export "analysis\fig_A4.emf", replace

* Fig A5
reg hybrid_school exp_group gender_2 left_right trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1
coefplot, drop(_cons) xline(0) msymbol(d) mcolor(white) levels(95 90 ) ciopts(lwidth(3 ..) lcolor(*.33 *.66 )) ///
legend(order( 1 "95%" 2 "90%" ) rows(1) position(6))
graph export "analysis\fig_A5.pdf", replace
graph export "analysis\fig_A5.emf", replace

* Fig A6
gen est15_both_groups_metric2 = est15_both_groups_metric / 100000
label variable est15_both_groups_metric2 "estimation: number of infected persons (in 100,000)"

reg contact_reductions est15_both_groups_metric2 gender_2 left_right trust  measures_appropriate restrict_rights strain  if no_missing_reg == 1
coefplot, drop(_cons) xline(0) msymbol(d) mcolor(white) levels(95 90 ) ciopts(lwidth(3 ..) lcolor(*.33 *.66 )) ///
legend(order( 1 "95%" 2 "90%" ) rows(1) position(6))
graph export "analysis\fig_A6.emf", replace












